import { BannerType } from "@/types/banner"
import { BookType, TypeListType } from "@/types/book"
import { BorrowType } from "@/types/borrow"
import { FloorType } from "@/types/floor"
import { roleType } from "@/types/role"
import { Seat, SeatType } from "@/types/seat"
import { User, RoleList } from "@/types/user"
import { WillType } from "@/types/will"
import  request from "@/utils/request"
//邮箱验证
export const reqCheckMail=(mail:string)=>request.get(`/userList/checkInfo/mail/${mail}`)

//手机号验证
export const reqCheckPhone=(phoneNumber:string)=>request.get(`/userList/checkInfo/phoneNumber/${phoneNumber}`)

//密码修改
export const reqEditPasswd=(info:User)=>request.post(`/admin/editPassword`,info)




//----------------------------------------角色操作------------------------------------------------

//获取角色列表
export const reqGetRoleList=()=>request.get('/roleList/get')

//添加角色
export const reqAddRole=(roleInfo:roleType)=>request.post('/roleList/addRole',roleInfo)

//修改角色
export const reqEditRole=(roleInfo:roleType)=>request.post('/roleList/editRole',roleInfo)

//删除角色
export const reqDeleteRole=(roleid:number)=>request.get('/roleList/deleteRole/'+roleid)

//搜索角色
export const reqSearchRole=(keyWord:string)=>request.post('/roleList/searchRole',keyWord)

//获取角色信息
export const reqGetRoleInfo=(roleid:number)=>request.get('roleList/getRoleInfo/'+roleid)















//----------------------------------------管理员操作------------------------------------------------

//获取管理员列表
export const reqGetMangerList=(page:number,limit:number)=>request.get(`/userList/getUserList/admin/${limit}/${page}`)
//批量删除管理员
export const reqDeleteMangerMore=(uids:string[])=>request.post('/deleteMangerMore',uids)
//删除管理员
export const reqDeleteManger=(uid:string)=>request.delete(`/deleteManger/${uid}`)
//修改管理员信息
export const reqEditManger=(mangerInfo:User)=>request.post(`/reader/updateReader`,mangerInfo)
//新增管理员信息
export const reqAddManger=({uid,roleid}:{uid:string,roleid:string})=>request.post(`/userList/addAdmin`,{uid,roleid:parseInt(roleid)})

//管理员搜索
export const reqSearchUser=(keyWord:string,num:number,page:number)=>request.post(`/userList/searchUser/admin/${num}/${page}`,keyWord)




//----------------------------------------轮播图管理操作------------------------------------------------
//获取轮播图列表
export const reqGetBannerList=(page:number,limit:number)=>request.get(`/bannerList/getBanner/${limit}/${page}`)
//删除轮播图
export const reqDeleteBannerOne=(lid:number)=>request.get(`/bannerList/deleteBanner/${lid}`)

//添加轮播图
export const reqAddBanner=(bannerInfo:BannerType)=>request.post('/bannerList/addBanner',bannerInfo)
//修改轮播图
export const reqEditBanner=(bannerInfo:BannerType)=>request.post(`/bannerList/editBanner`,bannerInfo)

//轮播查找
export const reqSearch=(value:string,state:string,num:number,page:number)=>request.post(`/bannerList/searchBanner/${state}/${num}/${page}`,value)




//----------------------------------------用户管理操作------------------------------------------------
export const reqGetUserList=(page:number,limit:number)=>request.get(`/userList/getUserList/reader/${limit}/${page}`)
//批量删除用户
export const reqDeleteUserMore=(uids:string[])=>request.post('/deleteUserMore',uids)
//删除用户
export const reqDeleteUserOne=(info:User)=>request.post(`/userList/deleteUserInfo`,info)
//添加用户
export const reqAddUser=(baseInfo:User)=>request.post('/reader/register',baseInfo)
//通过uid获取用户基本信息
export const reqGetUser=(uid:string)=>request.get(`/userList/getUserInfoByUid/${uid}`)

//搜索用户
export const reqSearchUserCommon=(value:string,num:number,page:number)=>request.post(`/userList/searchUser/reader/${num}/${page}`,value)
//通过uid获取用户所有信息
export const reqGetUserAll=(uid:string)=>request.get(`/userList/getUserDetail/${uid}`)


//通过uid查询用户借阅记录
export const reqGetBorrowListByUid=(uid:string,num:number,page:number)=>request.get(`/borrowList/getBorrowList/${uid}/${num}/${page}`)

//通过uid查询用户预约记录

export const reqGetWillListByUid=(uid:string,num:number,page:number)=>request.get(`/willList/getWillListByUid/${uid}/${num}/${page}`)









//--------------------------------------借阅管理-----------------------------------------------------------
export const reqGetBorrList=(num:number,page:number)=>request.get(`/borrowList/getBorrowListAll/${num}/${page}`)

//删除借阅信息
export const reqDeleteBorrInfo=(borrOne:BorrowType)=>request.post(`/borrowList/deleteBorrowOne`,borrOne)

//修改借阅信息
export const reqEditBorrInfo=(borrOne:BorrowType)=>request.post(`/borrowList/updateBorrowOne`,borrOne)

//搜索借阅
export const reqSearchBorrow=(keyWord:string,state:number,num:number,page:number)=>request.post(`/borrowList/searchBorrow/${state}/${num}/${page}`,keyWord)








//-------------------------图书管理-----------------------------------------------
export const reqGetBookList=(num:number,page:number)=>request.get(`/bookList/getBookList/${num}/${page}`)

//搜索
export const reqSearchBook=(keyword:string,type:number,num:number,page:number)=>request.post(`/bookList/searchBookList/${type}/${num}/${page}`,keyword)

//添加图书

export const reqAddBook=(book:BookType)=>request.post(`/bookList/addBook`,book)
//修改图书
export const reqEditBook=(book:BookType)=>request.post(`/bookList/updateBook`,book)

//删除图书
export const reqDeleteBook=(book:BookType)=>request.post(`/bookList/deleteBook`,book)


//-----------------------------图书类型管理---------------------------------------------
export const reqGetTypeList=(num:number,page:number)=>request.get(`/admin/getList/type/${num}/${page}`)

export const reqSearchType=(fid:number,num:number,page:number)=>request.post(`/admin/searchTypeList/${fid}/${num}/${page}`)
//添加图书类型
export const reqaddBookType=(type:TypeListType)=>request.post(`typeList/addType`,type)
//删除楼层
export const reqDeleteBookType=(type:TypeListType)=>request.post(`typeList/deleteType`,type)





//---------------------楼层管理----------------------------------
export const reqGetFloorList=()=>request.get('floorList/getAllFloor')

//添加楼层

export const reqAddFloor=(floorOne:FloorType)=>request.post(`floorList/addFloor`,floorOne)

//更新楼层信息

export const reqEditFloor=(floorOne:FloorType)=>request.post(`floorList/updateFloor`,floorOne)

//删除楼层
export const reqDeleteFloor=(floorOne:FloorType)=>request.post(`floorList/deleteFloor`,floorOne)


//--------------------获取地址---------------------------------------
export const reqGetAddress=()=>request.get(`address/getAddress`)
//修改地址
export const reqUpdateAddress=(address:any)=>request.post(`address/updateAddress`,address)





//-----------------------座位类型管理-------------------------------
export const reqGetSeatTypeList=(num:number,page:number)=>request.get(`/typeseatList/getSeatTypeList/${num}/${page}`)
//修改
export const reqUpdateSeatType=(type:SeatType)=>request.post(`/typeseatList/updateSeatType`,type)
export const reqAddSeatType=(type:SeatType)=>request.post(`/typeseatList/addSeatType`,type)
export const reqDeleteSeatType=(type:SeatType)=>request.post(`/typeseatList/deleteSeatType`,type)


//---------------------------座位管理-----------------------------------------------

export const reqGetSeatList=(num:number,page:number)=>request.get(`/seatList/getSeatList/${num}/${page}`)

//添加
export const reqAddSeat=(seat:Seat)=>request.post('/seatList/addSeatList',seat)
//搜索
export const reqSearchSeatList=(str:string,fid:number,state:number,seattype:number,num:number,page:number)=>request.post(`/seatList/searchSeatList/${fid}/${state}/${seattype}/${num}/${page}`,str)
//更新
export const reqUpdateSeat=(seat:Seat)=>request.post(`/seatList/updateSeatList`,seat)

//更新
export const reqDeleteSeat=(seat:Seat)=>request.post(`/seatList/deleteSeatList`,seat)

//通过fid获取座位
export const reqGetSeatListyfid=(fid:number)=>request.get(`/seatList/getSeatByFid/${fid}`)

//获取座位升级版
export const reqGetListPlust=(info:any)=>request.post(`/app/getSeatListPlus`,info)

//获取时间升级版
export const reqGetTimeListPlus=(info:any)=>request.post(`/app/getTimePlus`,info)


//预约
export const reqAddWillList=(info:WillType)=>request.post(`/willList/addWill`,info)


export const  reqDeletewill=(info:WillType)=>request.post(`/willList/cancel`,info)


//-----------------------------------预约管理-----------------------------------------------------
export const reqGetWillList=(num:number,page:number)=>request.get(`/willList/getWillList/${num}/${page}`)

export const reqSearchWillList=(str:string,state:number,num:number,page:number)=>request.post(`/willList/searchWillList/${state}/${num}/${page}`,str)



